<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.vsked.database.*"%>
<%@page import="com.vsked.bean.*"%>
<%@page import="com.vsked.util.*"%>
  <%
  ConnectionInfo ci=(ConnectionInfo)session.getAttribute("ci");
  if(request.getParameter("tname")!=null){
	  String tname=request.getParameter("tname");
	 List<Map> columnList=ColumnInfo.getTableColumnNameAndDataType(ci,request.getParameter("tname"));
  %>
<html>
<jsp:include page="../Head.jsp"></jsp:include>  
  <body class='tundra'> 
  <form method="post"  dojoType="dijit.form.Form" action="Connection/ProcessTableColumn.jsp"  onsubmit="return checkColumnNameIsNull();" >
  <input type="hidden" name="tname" value="<%=tname %>" />
  <table style="border: 1px solid #9f9f9f;" cellspacing="10">
  <tr>
    <td>主键</td>
    <td>字段</td>
    <td>是否显示</td>
    <td>显示名称</td>
    <td>类型</td>
    <td>添加</td>
    <td>修改</td>
    <td>序列</td>
  </tr>
  <%
  if(columnList!=null){
	  for(int i=0;i<columnList.size();i++){
		  Map columnMap=columnList.get(i);
		  Iterator it=columnMap.entrySet().iterator();
		  out.print("<tr>");
		  while(it.hasNext()){
				Map.Entry me=(Map.Entry)it.next();
				String columnNameStr=Symbol.replaceSymbol(me.getKey().toString());
				String inColumn=columnNameStr;
				String inColumnDataType="";
				if("MsSqlServer2000".equals(ci.getDbType()))
					inColumnDataType=TransFormDataType.getSqlServerDataType(Integer.parseInt(me.getValue().toString()));
				if("MySql".equals(ci.getDbType()))
					inColumnDataType=TransFormDataType.getMySqlDataType(me.getValue().toString());
				%>
				<td><input type="radio" name="primaryKey" value="<%=inColumn %>#<%=inColumnDataType %>" <%=i==0?" checked ":"" %> dojoType="dijit.form.RadioButton"></td>
				<td><%=inColumn %></td>
				<td><input type='checkbox' name='isView' value='<%=inColumn %>' dojoType="dijit.form.CheckBox" /></td>
				<td><input type='text' name='<%=inColumn %>' id='<%=inColumn %>' dojoType="dijit.form.ValidationTextBox"  trim="true"  propercase="false" /></td>
				<td><%=inColumnDataType %> </td>
				<td><input type="checkbox" name='add'  value='<%=inColumn %>#<%=inColumnDataType %>' dojoType="dijit.form.CheckBox" /></td>
				<td><input type="checkbox" name='edit' value='<%=inColumn %>#<%=inColumnDataType %>' dojoType="dijit.form.CheckBox" /></td>
				<td><%=i %></td>
				
				<%
		  }
		  out.print("</tr>");
	  }
  }
  %>
  <tr>
      <td colspan='10'>
      bean所在包名:
      <input type="text" name="beanPackage" id="beanPackage" value='com.<%=tname.replace("Tb_","").toLowerCase() %>module.bean' dojoType="dijit.form.ValidationTextBox" style="width: 15em;" trim="true"  propercase="false">
      dao所在包名:
      <input type="text" name="daoPackage" id="daoPackage" value='com.<%=tname.replace("Tb_","").toLowerCase() %>module.dao' dojoType="dijit.form.ValidationTextBox" style="width: 15em;" trim="true"  propercase="false">
      servlet所在包名:
      <input type="text" name="servletPackage" id="servletPackage"  value='com.<%=tname.replace("Tb_","").toLowerCase() %>module.servlet' dojoType="dijit.form.ValidationTextBox" style="width: 15em;" trim="true"  propercase="false">
      jsp文件夹:
      <input type="text" name="jspFolder" id="jspFolder"  value='<%=Symbol.getStringFirstUpperCase(tname.replace("Tb_","").toLowerCase()) %>Module' dojoType="dijit.form.ValidationTextBox" style="width: 15em;" trim="true"  propercase="false">
      </td>
  </tr>
  <tr>
    <td colspan="10" align="center" >
    <button dojoType="dijit.form.Button" type="submit" id='btset1'>设置  </button>
    <button dojoType="dijit.form.Button" type="reset" id='btreset1'>重置  </button>
    </td>
  </tr>
</table>
</form>
  <jsp:include page="../Foot.jsp"></jsp:include>  
  </body>
</html>
<%
}
%>